#!/usr/bin/env python
# coding:utf-8

import csv

import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from pandas import Series


class Plots(object):

    def __init__(self, file):
        self.username = file



    def k(self):
        x = np.array([1, 2, 3, 4, 5, 6, 7, 8])
        y = np.array([3, 5, 7, 6, 2, 6, 10, 15])
        plt.plot(x, y, 'r')  # 折线 1 x 2 y 3 color
        plt.plot(x, y, 'g', lw=10)  # 4 line w
        # 折线 饼状 柱状
        x = np.array([1, 2, 3, 4, 5, 6, 7, 8])
        y = np.array([13, 25, 17, 36, 21, 16, 10, 15])
        plt.bar(x, y, 0.2, alpha=1, color='b')  # 5 color 4 透明度 3 0.9
        plt.show()

    def plotF(self):
        x = np.linspace(-1, 1, 66)
        # 绘制y=2x+1函数的图像
        y = 2 * x + 1
        plt.plot(x, y)
        plt.show()

        # 绘制x^2函数的图像
        y = x ** 2
        plt.plot(x, y)
        plt.show()

    def plotzhexian(self , data1='a', data2='b'): # 画折线
        y1 = [10, 13, 5, 40, 30, 60, 70, 12, 55, 25]
        x1 = range(0, 10)
        x2 = range(0, 10)
        y2 = [5, 8, 0, 30, 20, 40, 50, 10, 40, 15]
        plt.plot(x1, y1, label='Frist line', linewidth=3, color='r', marker='o',
                 markerfacecolor='blue', markersize=12)
        plt.plot(x2, y2, label='second line')
        plt.xlabel('Plot Number')
        plt.ylabel('Important var')
        plt.title('Interesting Graph\nCheck it out')
        plt.show()

    def plotTest(self):
        a = Series(np.random.randn(1000), index=pd.date_range('20100101', periods=1000))
        b = a.cumsum()
        b.plot()
        plt.show()







